/*
 * @(#)CustomerTransactionFacade 1.0 2019/12/24
 *
 * Copyright 2019 JDJR All Rights Reserved.
 * PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 * Author Email: zhangshaobo16@jd.com
 */
package com.bo.demo.contoller;

import com.bo.demo.service.DemoService;
import com.bo.mvcframework.annotation.BoAutowired;
import com.bo.mvcframework.annotation.BoController;
import com.bo.mvcframework.annotation.BoRequestMapping;
import com.bo.mvcframework.annotation.BoRequestParam;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * 测试controller
 *
 * @description: 测试controller
 * @author: zhangshaobo16 on 2020/2/27.
 * @version： 1.0.0
 */
@BoController
@BoRequestMapping("/demo")
public class DemoController {
    @BoAutowired
    private DemoService demoService;

    @BoRequestMapping("/query")
    public void query(HttpServletRequest req, HttpServletResponse resq, @BoRequestParam("name") String name) throws IOException {
        String value = demoService.get(name);
        resq.getWriter().write(value);
    }

    @BoRequestMapping("/add")
    public void add(HttpServletRequest req, HttpServletResponse resq, @BoRequestParam("a") int a, @BoRequestParam("b") int b) throws IOException {
        resq.getWriter().write("a+b: " + (a + b));
    }
}
